 <?php form_head("admin/search_items","") ?>
 
		 
	
	
	<?php 
	
		

		 $rows =  $this->db->get("material_item_status")->result_array();
		 select_field("status_id","สถานะวัสดุ-ครุภัณฑ์",$rows,"name",0,0,"All",1,null,"",2); 
		 
	?>
	
	<?php 
	
		

		 $rows =  $this->db->get("material_types")->result_array();
		 select_field("type_id","ดูรายงานตาม ชนิด",$rows,"type_name",0,0,"All",1,null,"",2); 
		 
	?>
	
	<?php 
	
	$sql = "SELECT  CONCAT( meterial_base_categories.cat_base_name,'|',material_categories.category_name) as category_name,
		      material_categories.category_id, 
		      	meterial_base_categories.sort_order
		      FROM meterial_base_categories INNER JOIN material_categories ON meterial_base_categories.cat_base_id = material_categories.cat_base_id
			
		      order by sort_order asc";

		 $rows =  $this->db->query($sql)->result_array();
		 select_field("category_id","ดูรายงานตาม หมวดวัสดุ-ครุภัณฑ์",$rows,"category_name",0,0,"All",1,null,"",2); 
		 ?>
		 	      
		 
		 <?php 
		 $rows =  $this->db->query("select budget_id, concat(budget_name,'-', year) as budget_name from budgets")->result_array();
		 select_field("budget_id","ดูรายงานตาม งบประมาณ/ปีการศึกษา",$rows,"budget_name",0,0,"All",0,null,"",2); 
		//select_field($name,$label,$rows,$label_value,$row,$cleaner = 0,$first_label="โปรดเลือก",$class ="",$type=1)
		 ?>
         <?php 
		 $rows =  $this->db->query("select company_id,concat(company_name,'')as company_name from company")->result_array();
		 select_field("company_id","บริษัทจัดหา",$rows,"company_name",0,0,"All",null,"",2); 
		 ?>
		 
		  <?php
				$date_rows = $this->db->query("select date_format(buy_date,'%d/%m/%Y') as buy_date from material_registers order by buy_date asc limit 0,1")->result_array();
					$buy_date = date("d/m/Y");
					if(count($date_rows))
					{
						$buy_date = $date_rows[0]["buy_date"];
					}
				
				text_field("buy_date","วันที่ซื้อ",array('buy_date'=>$buy_date),0,"date"); ?>
		   <?php text_field("buy_date2","จนถึงวันที่ซื้อ",array("buy_date2"=>date('d/m/Y')),0,"date"); ?>
	<?php form_footer("Filter"); ?>
	
	
  